﻿using HoverTree.BLL;
using HoverTree.Model;
using System;

namespace HoverTreeMobile.HvtAdmin.HvtPicture
{
    public partial class ImageSetAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text.Trim() == string.Empty)
            {
                ltlTips.Text = "标题不能为空";
                return;
            }
            ImageSetInfo m_info = new ImageSetInfo();
            m_info.HvtName = HoverTree.HoverTreeFrame.Utils.GetHoverTreeString();
            m_info.HvtTitle = txtTitle.Text;
            m_info.HvtCreateDate = DateTime.Now;
            m_info.HvtfatherFolder = HoverTree.HoverTreeFrame.HoverString.GetYear(m_info.HvtCreateDate);
            m_info.HvtisShow = cbIsShow.Checked;
            m_info.HvtIsTop = cbIsTop.Checked;
            m_info.HvtLink = txtLink.Text;

            HvtImageSet m_imageSet = new HvtImageSet();
            ltlTips.Text = m_imageSet.Add(m_info);
            if (ltlTips.Text == string.Empty)
            {
                ltlTips.Text = "添加成功";
                ResetInput();
            }
        }

        void ResetInput()
        {
            txtTitle.Text = "";
            txtLink.Text = "";
            cbIsShow.Checked = true;
            cbIsTop.Checked = false;
        }
    }
}